Skip to content

Conversation

Pezhman-Azizi
Copy link

@Pezhman-Azizi Pezhman-Azizi commented Sep 21, 2025

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Implement shell tools in Python:

Overview

This PR starts the Python implementation of shell tools by adding the cat command.
It is the first step in the implement-shell-tools-with-python branch, separate from the Node.js version.

Changes

Added cat/cat.py script.

Implemented functionality to:

Print file contents.

-n → number all lines.

-b → number only non-blank lines.

Handle multiple files and glob patterns (*.txt).

Added cat/sample-files/ directory with sample .txt files for testing.

Usage

Run from the project root:

python3 cat/cat.py cat/sample-files/1.txt
python3 cat/cat.py -n cat/sample-files/1.txt
python3 cat/cat.py -b cat/sample-files/3.txt
python3 cat/cat.py cat/sample-files/*.txt

Next Steps

Add Python implementations for ls and wc.

Questions

Copy link

Your PR description contained template fields which weren't filled in.

Check you've ticked everything in the self checklist, and that any sections which prompt you to fill in an answer are either filled in or removed.

@Pezhman-Azizi Pezhman-Azizi added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Sep 21, 2025
@LonMcGregor LonMcGregor added the Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. label Sep 24, 2025
Copy link

@LonMcGregor LonMcGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start on this sprint's tasks, I notice like your node implementations you are doing all the argument parsing yourself. Did you know python has a library that can do this for you?

@LonMcGregor LonMcGregor added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Sep 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reviewed Volunteer to add when completing a review with trainee action still to take.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants